
var app = getApp();

Page({

  /**
   * 页面的初始数据
   */
  data: {
    list:[],
    page:0,
    keyword:""
  },

  getSearch: function (e) {
    this.setData({
      keyword: e.detail.value,
      list: [],
      page:0,
    })
    this.getList();
  },

  //解读报告
  readyreport() {
    if (this.data.inquiry == 5) {
      wx.navigateTo({
        url: '/hyb_yl/zhuanjiasubpages/pages/huanzhexinxi/huanzhexinxi?inquiry=5',
      })
      return false
    }
    if (this.data.inquiry == 6) {
      wx.navigateTo({
        url: '/hyb_yl/zhuanjiasubpages/pages/orderedtime/orderedtime?inquiry=6',
      })
      return false
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    var parentid = options.parentid;
    that.setData({
      parentid:parentid
    })
    that.getList();
    

  },
  getList:function(){
    var that = this;
    app.util.request({
      'url':"entry/wxapp/regin.hospital_zhuanjia",
      data:{
        openid:wx.getStorageSync('openid'),
        keyword:that.data.keyword,
        page:that.data.page,
        parentid:that.data.parentid
      },
      success:function(res){
        that.setData({
          page:that.data.page + 1,
          list:that.data.list.concat(res.data)
        })
      }
    })
  },
  navigator(e) {
    var that = this
    var zid = e.currentTarget.dataset.zid
    var server = e.currentTarget.dataset.server
    var money = e.currentTarget.dataset.money
    var conets = JSON.stringify(that.data.conets)
    var tkid = app.globalData.tkid
    console.log(tkid)
    app.util.request({
      'url': 'entry/wxapp/index.iftuoke',
      data: {
        openid: wx.getStorageSync('openid')
      },
      success: function (res) {
        console.log(res)
        if (tkid == 0) {
          //我不是推客
          app.util.request({
            'url': 'entry/wxapp/zhuanjia.getdocerweima',
            data: {
              zid: zid,
            },
            success: function (res) {
              console.log(res)
            }
          })
        } else {
          //我是推客
          var id = res.data.id
          app.util.request({
            'url': 'entry/wxapp/zhuanjia.getdocerweima',
            data: {
              zid: zid,
              tkid: tkid
            },
            success: function (res) {
              console.log(res)
            }
          })
        }
      }
    })
      wx.navigateTo({
        url: '/hyb_yl/czhuanjiasubpages/pages/zhuanjiazhuye/zhuanjiazhuye?zid=' + zid + '&money=' + money,
      })
      return false;
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },


  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },

  onReachBottom: function () {
    var that = this;
    that.getList();
  },
})